﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Web.UI;
using System.ComponentModel;

namespace TA.Turbo.Controls
{
	public class TurboProgress : BasePopupControl
	{
		protected static new Properties _clientProperties = Define(BasePopupControl._clientProperties, new[] {
			new PropertyDefinition("DisplayTimeout", "DT", 0),
		});
		public override Dictionary<string, PropertyDefinition> ClientProperties
		{
			get
			{
				return _clientProperties;
			}
		}
		public TurboProgress()
		{
			InclusionMode = InclusionMode.AllExceptExcluded;

			//Define<int>("DisplayTimeout", new PropertyDefinitionOptions<int> { });
		}
		/// <summary>
		/// Number of milliseconds to wait before displaying the progress control.
		/// </summary>
		public int DisplayTimeout
		{
			get
			{
				return GetProperty<int>("DisplayTimeout");
			}
			set
			{
				ViewState["DisplayTimeout"] = value;
			}
		}
		public InclusionMode InclusionMode { get; set; }
		public string Scenarios { get { return _mpvScenarios.Value; } set { _mpvScenarios.Value = value; } }
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		[Browsable(false)]
		public List<string> ScenarioList { get { return _mpvScenarios.ValueList; } }
		#region INTERNAL
		MultiPartValue _mpvScenarios = new MultiPartValue();
		
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			TurboPage.Current.Includes.Add(new ScriptResourceInclude
			{
				Type = typeof(TurboProgress),
				Resource = "TA.Turbo.Resources.JS.Popup.TurboProgress.js"
			});

			TurboPage.Current.ProgressControls.Add(this);
		}
		#endregion
	}
}
